package com.aspose.cells;

class zcj {
   protected zn a;
   protected boolean b = false;
   protected float c;
   protected float d;
   protected zbkq e;
   protected float f = 0.0F;
   protected float g;
   protected float h;
   private boolean i = false;

   zcj(zn var1, float var2, float var3, zbkq var4) {
      this.a = var1;
      this.e = var4;
      this.c = var2;
      this.d = var3;
      this.g = this.c;
      this.h = this.d;
      com.aspose.cells.b.a.b.a.zi var5;
      if (!this.e.d || !this.e.c.E() && !this.e.c.D() && this.e.c.j() == 0) {
         var5 = new com.aspose.cells.b.a.b.a.zi();
         switch(this.e.H()) {
         case 0:
            if (this.e.E() || this.e.D() || this.e.j() != 0) {
               var5 = this.a(this.e);
            }
            break;
         case 13:
         case 20:
         case 32:
         case 87:
         case 136:
            if (var4.j() != 0) {
               com.aspose.cells.b.a.b.zq var6 = new com.aspose.cells.b.a.b.zq(this.c, this.d, this.e.k().h(), this.e.k().i());
               if (this.e.k().i() == 0.0F || this.e.k().h() == 0.0F) {
                  var6 = new com.aspose.cells.b.a.b.zq(this.e.F().f(), this.e.F().g(), this.e.F().h(), this.e.F().i());
               }

               com.aspose.cells.b.a.b.zo var7 = new com.aspose.cells.b.a.b.zo(var6.f() + var6.h() / 2.0F, var6.g() + var6.i() / 2.0F);
               var5.b(zbuk.a(var7.d()), zbuk.a(var7.e()));
               var5.a((float)var4.j());
               var5.b(-zbuk.a(var7.d()), -zbuk.a(var7.e()));
               this.i = true;
            }
            break;
         case 33:
         case 34:
         case 35:
         case 36:
         case 37:
         case 38:
         case 39:
         case 40:
            var5 = this.a(this.e);
            break;
         case 53:
            if (!this.e.D()) {
               this.e.a(this.e.j() + 180);
               var5 = this.a(this.e.j());
            } else if (this.e.j() > 0) {
               var5 = this.a(this.e.j());
            }
            break;
         case 54:
            if (this.e.D()) {
               this.e.a(this.e.j() + 180);
               var5 = this.a(this.e.j());
            } else if (this.e.j() > 0) {
               var5 = this.a(this.e.j());
            }
            break;
         default:
            if (this.e.j() > 0) {
               if (!this.e.d && !this.e.f) {
                  var5 = this.b(this.e);
               } else {
                  var5 = this.a(var4.j());
               }
            }
         }

         this.a.a(var5);
      } else {
         var5 = this.a(this.e.c);
         this.a.a(var5);
      }
   }

   com.aspose.cells.b.a.b.a.ze a(com.aspose.cells.b.a.b.zq var1) {
      return new com.aspose.cells.b.a.b.a.ze();
   }

   void a(zn var1, float var2, float var3, float var4, float var5) {
      com.aspose.cells.b.a.b.zq var6 = new com.aspose.cells.b.a.b.zq(var2, var3, var4, var5);
      com.aspose.cells.b.a.b.a.ze var7 = this.a(var6);
      com.aspose.cells.b.a.b.zm var8 = zbul.a(this.e.m());
      com.aspose.cells.b.a.b.a.zf var9 = var1.e();
      var1.a(4);
      var1.a(var8, var7);
      var1.a(var9);
   }

   void b(zn var1, float var2, float var3, float var4, float var5) {
      com.aspose.cells.b.a.b.zq var6 = new com.aspose.cells.b.a.b.zq(var2, var3, var4, var5);
      com.aspose.cells.b.a.b.a.ze var7 = this.a(var6);
      com.aspose.cells.b.a.b.zc var8 = zbul.a(this.e.l(), var7);
      com.aspose.cells.b.a.b.a.zf var9 = var1.e();
      var1.a(4);
      var1.a(var8, var7);
      var1.a(var9);
   }

   void a() {
      new com.aspose.cells.b.a.b.zq(this.c, this.d, this.e.k().h(), this.e.k().i());
      if (!this.e.l().a()) {
         this.b(this.a, this.c, this.d, this.e.k().h(), this.e.k().i());
      }

      if (!this.e.m().a()) {
         this.a(this.a, this.c, this.d, this.e.k().h(), this.e.k().i());
      }

      this.b();
   }

   void b() {
      this.b(this.e.k());
   }

   void b(com.aspose.cells.b.a.b.zq var1) {
      if (!this.e.t().equals("\n")) {
         if (!this.e.m().a()) {
            var1.a(-(this.e.m().f() / 2.0F), -(this.e.m().f() / 2.0F));
         }

         float var2 = zbul.a(this.e.n());
         if (this.e.p() == 7) {
            var1.a(var1.f() + var2);
            var1.c(var1.h() - var2);
         } else if (this.e.p() == 8) {
            var1.c(var1.h() - var2);
         }

         var1.a(var1.f() + (float)this.e.d().a());
         var1.c(var1.h() - (float)(this.e.d().a() + this.e.d().c()));
         var1.b(var1.g() + (float)this.e.d().b());
         var1.d(var1.i() - (float)(this.e.d().b() + this.e.d().d()));
         if (var1.i() < (float)this.e.n().d()) {
            float var3 = ((float)this.e.n().d() - var1.i()) / 2.0F;
            var1 = new com.aspose.cells.b.a.b.zq(var1.f(), var1.g() - var3, var1.h(), (float)this.e.n().d());
         }

         com.aspose.cells.b.a.b.a.zf var5 = null;
         if (this.i) {
            var5 = this.a.e();
            com.aspose.cells.b.a.b.zn var4 = new com.aspose.cells.b.a.b.zn((int)(var1.j() + var1.h() / 2.0F), (int)(var1.k() + var1.i() / 2.0F));
            this.a.b((float)var4.a(), (float)var4.b());
            this.a.a((float)(-this.e.j()));
            this.a.b((float)(-var4.a()), (float)(-var4.b()));
         }

         zbul.a(this.a, this.e, var1, this.e.t(), this.e.s(), this.e.n(), this.e.o(), this.e.p(), this.e.q());
         if (this.i && var5 != null) {
            this.a.a(var5);
         }

      }
   }

   private com.aspose.cells.b.a.b.a.zi a(int var1) {
      com.aspose.cells.b.a.b.a.zi var2 = new com.aspose.cells.b.a.b.a.zi();
      com.aspose.cells.b.a.b.zq var3 = new com.aspose.cells.b.a.b.zq(this.c, this.d, this.e.k().h(), this.e.k().i());
      com.aspose.cells.b.a.b.zo var4 = new com.aspose.cells.b.a.b.zo(var3.f() + var3.h() / 2.0F, var3.g() + var3.i() / 2.0F);
      var2.b(zbuk.a(var4.d()), zbuk.a(var4.e()));
      var2.a((float)var1);
      var2.b(-zbuk.a(var4.d()), -zbuk.a(var4.e()));
      this.i = true;
      return var2;
   }

   private com.aspose.cells.b.a.b.a.zi b(zbkq var1) {
      com.aspose.cells.b.a.b.a.zi var2 = new com.aspose.cells.b.a.b.a.zi();
      int var5 = var1.j();
      Math.abs(var1.f() - var1.g());
      float var3;
      float var4;
      if ((var5 < 45 || var5 >= 135) && (var5 < 225 || var5 >= 315)) {
         var3 = var1.h() + var1.f() / 2.0F;
         var4 = var1.i() + var1.g() / 2.0F;
      } else if (var1.T()) {
         var3 = var1.i() + var1.g() / 2.0F;
         var4 = var1.h() + var1.f() / 2.0F;
      } else {
         var3 = var1.h() + var1.f() / 2.0F;
         var4 = var1.i() + var1.g() / 2.0F;
      }

      var2.a((float)var5, new com.aspose.cells.b.a.b.zo(zbuk.a(var3), zbuk.a(var4)));
      if ((var5 >= 45 && var5 < 135 || var5 >= 225 && var5 < 315) && var1.T()) {
         var2.b(zbuk.a(var1.g() / 2.0F - var1.f() / 2.0F), zbuk.a(var1.f() / 2.0F - var1.g() / 2.0F));
      }

      this.i = true;
      return var2;
   }

   com.aspose.cells.b.a.b.a.zi a(zbkq var1) {
      float var2 = 0.0F;
      float var3 = 0.0F;
      if ((var1.j() < 45 || var1.j() >= 135) && (var1.j() < 225 || var1.j() >= 315)) {
         var2 = var1.h() + var1.f() / 2.0F;
         var3 = var1.i() + var1.g() / 2.0F;
      } else {
         var2 = 1.0F + var1.g() / 2.0F;
         var3 = 1.0F + var1.f() / 2.0F;
      }

      com.aspose.cells.b.a.b.a.zi var4 = new com.aspose.cells.b.a.b.a.zi(var1.E() ? -1.0F : 1.0F, 0.0F, 0.0F, var1.D() ? -1.0F : 1.0F, var1.E() ? zbuk.a(var2 * 2.0F) : 0.0F, var1.D() ? zbuk.a(var3 * 2.0F) : 0.0F);
      var4.a(var1.E() ^ var1.D() ? (float)(-var1.j()) : (float)var1.j(), new com.aspose.cells.b.a.b.zo(zbuk.a(var2), zbuk.a(var3)));
      if (var1.j() >= 45 && var1.j() < 135 || var1.j() >= 225 && var1.j() < 315) {
         if (var1.j() == 90) {
            var4.b(var1.g() / 2.0F - var1.f() / 2.0F, var1.f() / 2.0F - var1.g() / 4.0F);
         } else {
            var4.b(var1.g() / 2.0F - var1.f() / 2.0F, var1.f() / 2.0F - var1.g() / 2.0F);
         }
      } else if (var1.j() == 180 || var1.j() == 0) {
         var4.b(zbuk.a(var1.h()), zbuk.a(var1.i()));
      }

      this.i = true;
      return var4;
   }

   public void c() {
      this.a(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   protected void a(boolean var1) {
      if (!this.b) {
         if (var1) {
            ;
         }

         this.b = true;
      }

   }

   protected void finalize() throws Exception {
      this.c();
   }
}
